#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4+10, INF = 0x3f3f3f3f;
vector<int> G[maxn];
int d[maxn][3];

inline int min(int a, int b, int c){
    int t = min(a, b);
    return min(t, c);
}

void dfs(int u, int fa){
    d[u][0] = 1, d[u][1] = 0, d[u][2] = 0;
    int inc = INF;
    for(auto v:G[u])if(v!=fa){
        dfs(v, u);
        d[u][0] += min(d[v][0], d[v][1], d[v][2]);
        d[u][1] += min(d[v][0], d[v][2]);
        d[u][2] += min(d[v][0], d[v][2]);
        inc = min(inc, d[v][0] - d[v][2]);
    }
    if(inc!=INF && inc>0) d[u][2] += inc;
    if(G[u].size() == 1 && u!=fa) d[u][2] = 1;
    if(u == fa) d[u][1] = d[u][0];
}

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int N; cin >> N;
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(1, 1);
    cout << min(d[1][0], d[1][2]) << "\n";
    return 0;
}